<?php

class C_start extends CI_Controller {

	public function index(){
		//Loading page header.
		$this->load->view('templates/v_header');
		
		//Determine if the user is loged in.
		if ($this->session->userdata('user_loged_in')) {
			//Loading meny for loged in users.
			$this->load->view('templates/v_menu_logedin');
			
			//Creating an user object.
			$this->load->model('m_user', 'user');
			
			//Fetching user id.
			$user_id = $this->session->userdata('user_userid');
			
			//Load the userdata.
			$this->user->load_userdata($user_id);
			
			//Getting user information that are to be displayed.
			$page_data = $this->user->get_info(array('username', 'signup_date'));
			
			//Load loged in start page.
			$this->load->view('pages/v_start_loged_in', $page_data);
		}
		else {
			//Load basic meny (for guests).
			$this->load->view('templates/v_menu_basic');
			
			$this->load->view('pages/v_start');
		}
		
		//Loading page footer.
		$this->load->view('templates/v_footer');
	}
}
?>